import Vue from 'vue'
import VueRouter from 'vue-router'
import Home from '../views/Home.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'Home',
    component: Home,
    redirect:"/leader",
    children:[
      {
        path:"/leader",
        name:"Leader",
        component:()=>import("../components/leader/Leader.vue"),
        redirect:'/leader/echarts',
        children:[
          {
            path:'photo',
            name:"Photo",
            component:()=>import("../components/children/photo.vue")
          },
          {
            path:'list',
            name:"List",
            component:()=>import("../components/children/list.vue")
          },{
            path:"echarts",
            name:"Echarts",
            component:()=>import("../components/echarts/echarts.vue")
          }
        ]
      },
      {
        path:"/commodity",
        name:"Commodity",
        component:()=>import("../components/commodity/Commodity.vue"),
        redirect:"/commodity/list",
        children:[
          {
            path:"classify",
            name:"Classify",
            component:()=>import("../components/children/Classify.vue")
          },
          {
            path:"list",
            name:"List",
            component:()=>import("../components/children/list.vue")
          },
          {
            path:"critic",
            name:"Critic",
            component:()=>import("../components/children/Critic.vue")
          },
          {
            path:"type",
            name:"Type",
            component:()=>import("../components/children/Type.vue")
          },
          {
            path:"specification",
            name:"Specification",
            component:()=>import("../components/children/Specification.vue")
          }
        ]
      },{
        path:"/order",
        name:"Order",
        component:()=>import("../components/commodity/Order.vue"),
        redirect:"/order/order",
        children:[
          {
            path:"order",
            name:"Order",
            component:()=>import("../components/children/Order.vue")
          },
          {
            path:"after",
            name:"After",
            component:()=>import("../components/children/after.vue")
          },{
            path:"invoiec",
            name:"Invoiec",
            component:()=>import("../components/children/invoice.vue")
          }
        ]
      },{
        path:"/svip",
        name:"Svip",
        component:()=>import("../components/commodity/Svip.vue"),
        redirect:"/svip/sviplist",
        children:[
          {
            path:"class",
            name:"Class",
            component:()=>import("../components/children/class.vue")
          },
          {
            path:"sviplist",
            name:"Sviplist",
            component:()=>import("../components/children/Sviplist.vue")
          }
        ]
      },{
        path:"/set",
        name:"Set",
        component:()=>import("../components/commodity/Set.vue"),
        redirect:"/set/basics",
        children:[
          {
            path:"administrator",
            name:"Administrator",
            component:()=>import("../components/children/Administrator.vue")
          },
          {
            path:"basics",
            name:"Basics",
            component:()=>import("../components/children/basics.vue")
          },{
            path:"deal",
            name:'Beal',
            component:()=>import("../components/children/deal.vue")
          },
          {
            path:"logistics",
            name:"Logistics",
            component:()=>import("../components/children/logistics.vue")
          }
        ]
      }
    ]
  },
  {
    path: '/about',
    name: 'About',
    // route level code-splitting
    // this generates a separate chunk (about.[hash].js) for this route
    // which is lazy-loaded when the route is visited.
    component: function () {
      return import(/* webpackChunkName: "about" */ '../views/About.vue')
    }
  },
  {
    path:"/login",
    name:"Login",
    component:()=>import("../components/login/Login.vue")
  }
]

const router = new VueRouter({
  mode: 'history',
  base: process.env.BASE_URL,
  routes
})

export default router
